package org.study.springboot.restful.api;

import org.springframework.web.bind.annotation.*;
import org.study.springboot.restful.model.Dogs;
import org.study.springboot.restful.model.RespBean;

/**
 * @author fangyu
 * @version v1.0.0
 * @date 2020/10/8 6:53 下午
 */
@RequestMapping("/dogs")
@RestController
public class DogsApi {

  @GetMapping("/{id}")
  public RespBean get(@PathVariable("id") String id) {
    return RespBean.ok(id);
  }

  @GetMapping()
  public RespBean getAll() {
    return RespBean.ok();
  }

  @PostMapping()
  public RespBean add(@RequestBody Dogs dogs) {
    return RespBean.ok(dogs);
  }

  @PutMapping("/{id}")
  public RespBean edit(@PathVariable("id") String id, @RequestBody Dogs dogs) {
    return RespBean.ok();
  }

  @DeleteMapping("/{id}")
  public RespBean delete(@PathVariable("id") String id) {
    return RespBean.ok(id);
  }
}
